<template>
	<view>
	<uni-list>
		<uni-list-item :clickable="true" :title="item.name"  v-for="(item, index) in data" :key="index" @click="change(item)">
			  <!-- <view>{{ item.name }}</view> -->
		</uni-list-item>
		
	</uni-list>
	</view>
</template>

<script>

import cookie from "@/utils/store/cookie";
import { getOnlinePrint } from '@/api/shanghu.js';
	export default {
		data() {
			return {
				data:[],
			}
		},
		created() {
			this.getData()
		},
		computed:{
			
		},
		methods: {
			change(item){
				console.log("/pages/home/index",item)
				cookie.set("print",item.name);
				cookie.set("printIp",item.ip);
				uni.navigateBack({
				delta:1,//返回层数，2则上上页
				})
			
			},
			getData(){
				getOnlinePrint().then(res => {
					this.data = res.data
				}).catch(function (err) {
				  console.error('发生错误:', err);
				});
			}
		}
	}
</script>

<style>

</style>
